package pl.ydp.components.mathcell.mathrecognizer.geometry.extractor
{
	import pl.ydp.components.mathcell.mathrecognizer.geometry.classification.PrimitiveSubstanceType;
	
	public class PrimitiveSubstance
	{
		public function PrimitiveSubstance(_beginIndex:Number, _generalType:Number, _curveType:Number = 0, _endIndex:Number = -1, _helixity:Number = -1){
			begin = _beginIndex;
			type = PrimitiveSubstanceType.fromGeneralType(_generalType, _curveType);
			
			if (_endIndex == -1){
				finished = false;	
				length = 0;
			} else {
				end = _endIndex;
				finished = true;
				length = end - begin;
			}
			if (_helixity == -1){
				helixCount = 0;
			} else {
				helixCount = _helixity;
			}
		}
		
		public var begin:Number;
		public var end:Number;
		public var type:Number;
		public var helixCount:Number;
		
		public var length:Number;
		
		protected var finished:Boolean;
		
		public function finish(_endIndex:Number, _helixCount:Number = 0):void{
			end = _endIndex;
			helixCount = _helixCount;
			finished = true;
			length = end - begin;
		}
		
		public function isFinished():Boolean{
			return finished;
		}
		

	}
}